﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GLImp;
using System.Drawing;
using CastleOfTheDisillusioned.Particles;

namespace CastleOfTheDisillusioned.Enemies {
	class Statue : Enemy {
		static Subimage StatueTex = Textures.GlyphStatue.Subimage(65, 3, 32, 64);
		public Statue(double X, double Y) {
			this.X = X;
			this.Y = Y;
			this.Width = 2;
			this.Height = 4;

			TouchDamage = false;
			Health = 1;
		}

		public override void Draw(){
			StatueTex.Draw(X, Y, Width, Height);
		}

		public override void Destroy() {
			base.Destroy();

			List<Subimage> Gibs = new List<Subimage>();
			//Left Half
			Gibs.Add(new Subimage(Textures.GlyphStatue, 9, 5, 10, 10));
			Gibs.Add(new Subimage(Textures.GlyphStatue, 19, 5, 12, 12));
			Gibs.Add(new Subimage(Textures.GlyphStatue, 33, 5, 10, 16));
			Gibs.Add(new Subimage(Textures.GlyphStatue, 44, 5, 10, 16));
			Gibs.Add(new Subimage(Textures.GlyphStatue, 10, 20, 4, 10));
			Gibs.Add(new Subimage(Textures.GlyphStatue, 14, 23, 17, 10));
			Gibs.Add(new Subimage(Textures.GlyphStatue, 10, 34, 9, 17));
			Gibs.Add(new Subimage(Textures.GlyphStatue, 30, 25, 12, 28));
			Gibs.Add(new Subimage(Textures.GlyphStatue, 53, 21, 12, 14));
			Gibs.Add(new Subimage(Textures.GlyphStatue, 43, 35, 22, 14));

			//Right Half
			//TODO nicholas Right Half
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));
			//Gibs.Add(new Subimage(Textures.GlyphStatue, ));

			foreach (Subimage img in Gibs) {
				ImageParticle p = new ImageParticle(img, X + (Program.Random.NextDouble() * Width), Y + (Program.Random.NextDouble() * Height));
				p.HSpeed = (Program.Random.NextDouble() - 0.5) * 0.3;
				p.VSpeed = Program.Random.NextDouble() * -0.3;
				p.Lifespan = 60;
				p.Width = p.Width / 16;
				p.Height = p.Height / 16;
				p.Gravity = 0.01;

				ParticleManager.Track(p);
			}

		}
	}
}
